<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="./vue.js"></script>
</head>
<body>
<div id="root">
  <button @click="fn">操作</button>
  <one ref="one"></one>
</div>
</body>
<script>
  new Vue({
    el:"#root",
    components:{
      one:{
        data(){
          return {
            num:100
          }
        },
        template:`
          <button @click="num++">{{num}}</button>
        `
      }
    },
    mounted(){
      console.log(this.$refs.one);
    },
    methods:{
      fn(){
        this.$refs.one.num+=2;
      }
    }

  })
</script>
</html>